1. Field of the Invention
The present invention generally relates to a shaper circuit and a shaper circuit combination, and more particularly to a shaper circuit of a transmission apparatus for transmitting variable length packets.
2. Description of the Related Art
In recent years and continuing, the widespread use of the Internet and intranet has caused network traffic to grow significantly. It is, therefore, desired to improve the infrastructural technology along with the growth of IP (Internet Protocol) traffic. In particular, one objective is attaining a satisfactory quality during packet transfer.
Currently, shaper circuits, which are used for controlling the bandwidth through which packets are transmitted, have different configurations depending on the bandwidth and precision requested by the user of a transmission apparatus. Therefore, whenever a new transmission apparatus is developed, the shaper circuit is subjected to considerable amounts of design modifications and extensive testing in order to attain a satisfactory quality with respect to the new transmission apparatus. In order to respond to the demands for shortening the development period while maintaining a constant quality, a shaper circuit that is applicable to new transmission apparatuses is desired.
FIG. 1 is a block diagram showing an exemplary configuration of a transmission apparatus. In FIG. 1, received packets are stored in a shared memory 11. The packet distinguishing part 12 distinguishes (identifies) enqueue information of the received packets (e.g. priority class, packet length) of the received packets according to the information stored in the received packets.
The enqueue information is delivered to a scheduler part 13. The scheduler part 13 stores the enqueue information in its queues 13a-13c that are divided into priority classes. Once the information is stored in the queues 13a-13c, the scheduler part 13 sends a dequeue request to a shaper circuit 13d. 
The shared memory 11 reads out packet information of the dequeued packets and sends to a next step.
FIG. 2 is a block diagram showing an example of a conventional shaper circuit. In this example, a token bucket algorithm is used. FIG. 2 shows a shaper circuit 20 having a parameter storage part 21 and a token addition/subtraction part 22 which may play as a central part in the shaper circuit 20. A current token 21a, an add token 21b, and a max token 21c are fixed parameters that are stored in the parameter setting part 21.
The shaper circuit 20 requests for dequeue permission with respect to external queues 13a-13c and receives dequeue instructions and packet lengths from the queues 13a-13c. 
When dequeue instructions and packet lengths are input to the shaper circuit 20, a dequeue subtraction part inside the token addition/subtraction part 22 subtracts a length from the current token 21a which is stored as a parameter in the parameter storage part 21. After the current token 21a is subjected to the length subtraction, the current token 21a is returned to the parameter storage part 21. The dequeue permission determination part 21d determines whether to execute the next dequeue based on the results of the subtraction and outputs a dequeue permission request signal requesting for dequeue permission.
Meanwhile, a token is added at constant periodic intervals (token addition period). An add token addition part 22b adds an add token to the current token 21a. After the current token 21a is subjected to the add token addition, a max token part 22c compares the current token 21a with a max token 21c and sets the value of the current token 21a to be equal to the maximum value of the maximum token 21c. Then, after setting the value of the current token, the max token part 22c returns the current token 21a to the parameter storage part 21. Then, the dequeue permission determination part 21d determines whether to execute the next dequeue based on the value of the current value 21a and outputs a signal indicative of a dequeue permission request.
Next, the parameters including the current token, the add token, and the max token are described with reference to FIG. 3. The number of bits differs depending on factors such as the bandwidth and/or precision required by a transmission apparatus and is obtained by the below described process. Here, the bandwidth is indicated using bps (bits per second) which is a unit used in expressing the data transmission rate of a communication line, for example. 1 [bps] indicates that 1 bit of data can be transferred in a single second.
The current token 21a includes a code part (1 bit), an integer part A (A bits), and a decimal part B (B bits) [X=A+B]. The A bits of the integer part are equal to the number of bits in an integer part of the max token 21c. The B bits of the decimal part are equal to the number of bits in a decimal part of the add token 21b. 
The add token 21b includes an integer part “a” (a bits) and a decimal part “B” (B bits). Since the shaping rate “R” is expressed as [R=add token×8/token addition period], the add token satisfies a relationship of [add token=R×token addition period/8]. The value of a of the integer part “a” of the add token 21b is determined by the value of the upper limit (supremum) of the shaping rate R. The value of B of the decimal part B of the add token 21b is determined by the value of the bottom limit (infimum) of the shaping rate R.
For example, in a case where the shaping rate R satisfies a relationship of 1 Mbps≦R≦10 Gbps and where the token addition period is 200 ns, the add token 21b is as follows. That is, in a case where the shaping rate R is a band of 10 Gbps, the add token 21b satisfies a relationship of [add token<26] (bytes) and the number of bits of its integer part “a” is 7 bits. In a case where the shaping rate R is a band of 1 Mbps, the add token 21b satisfies a relationship of [add token>2−8] and the number of bits of its decimal part “B” is 8 bits.
Furthermore, the number of the bits of the decimal part “B” increases depending on the precision (granularity) to be obtained. For example, 6 bits are added for obtaining a precision satisfying a relationship of 3% (3/100)>26. Accordingly, in this case, the add token 21b includes 7 bits in its integer part and 14 (=8+6) bits in its decimal part. The max token 21c includes an integer part “A” (A bits). The number of bits of the integer part “A” is determined according to the maximum burst size.
The token addition period is no more than the minimal interval of packet transmission where burst transmission is not permitted due to error.
FIG. 4 is a schematic diagram showing a token bucket algorithm which is a basic algorithm used by a shaper circuit. In this token bucket algorithm, a token is added at predetermined intervals and a packet length is subtracted from a token upon a dequeue process. The shaping rate R satisfies a relationship of [R=add token value/token addition period]. Furthermore, a max token value equals the peak value of the contained buckets for limiting the burst.
The shaper circuit stores packet information into queues in an enqueu process. When a predetermined amount of packet information is accumulated in a corresponding queue, the queue is selected as the dequeue target. Then, in a dequeue process, the dequeue target is subjected to token subtraction for subtracting a predetermined packet length therefrom. An add token value is added at constant intervals (token addition period).
It is determined whether to dequeue a next enqueue packet by referring to the result of the token subtraction process or the periodic token addition of a previous dequeue packet (dequeue packet immediately before the next enqueue packet). In a case where the result of the token subtraction process or the periodic token addition of a previous dequeue packet is 0 or more, the next dequeue is possible.
If it is determined that the next dequeue is possible, a dequeue permission request is output. In a case where there is a dequeue instruction in response to the dequeue permission request, a predetermined packet length is subtracted from the next dequeue target (token). The determination is again conducted based on whether the subtraction result is less than 0.
In Japanese Laid-Open Patent Application No. 2003-198611, it is disclosed that a leaky bucket part changes the incremented value according to a level count value. In Japanese Laid-Open Patent Application No. 2002-368798 discloses a method of monitoring the band by providing a monitor mode corresponding to an input line and switching a leaky bucket algorithm according to flow identification information of input packets.
Conventionally, each transmission apparatus has its unique shaper since the number of bits of its parameters is fixed.
The following describes an exemplary case of sharing a shaper circuit between a first transmission apparatus and a second transmission apparatus. In the first transmission apparatus, the number of bits required for a parameter is 32 bits in order to satisfy a desired bandwidth and precision. Meanwhile, in the second transmission apparatus, the number of bits required for a parameter is 64 bits in order to satisfy the needs of the user.
In this case, among the shaper circuits of the first and second transmission apparatuses, the shaper circuit having a higher performance (function) is to be used as the shaper circuit shared by the first and second transmission apparatuses (in this case, the shaper circuit has 64 bits). However, in this case, although it may be possible to obtain a shared shaper circuit, the hardware scale (configuration) increases two times when this shaper circuit is applied.
Furthermore, since the number of bits of the parameters (bit numbers in the integer part and the decimal part) are fixed, a new shaper part is to be designed whenever a transmission apparatus having different specifications (e.g. band, precision, and number of queues) is developed. Therefore, whenever a new transmission apparatus is developed, the shaper circuit is subjected to considerable design modification and extensive testing in order to attain a satisfactory quality with respect to the new transmission apparatus.